const BASE_URL = 'http://localhost';
const TestHttp = (data) => {
	confirm("data="+data);
};

const http = (
	url,
	data = {},
	method = 'POST',
	header = {
		//"Content-Type": "application/json; charset=UTF-8",
	}
) => {
	let token = uni.getStorageSync('token') || '';
	if (!url) return;
	return new Promise((resolve, reject) => {
		uni.request({
			url: BASE_URL + url,
			method,
			data,
			header: {
				token,
				...header
			},
			success: (res) => {
				resolve(res)
			},
			fail: (err) => {
				reject(err);
			}
		});
	})
};
export default {http,TestHttp};